<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用 getFullYear() 显示年份</title>
</head>

<body>
    <h2>JavaScript getFullYear()</h2>
    <p>getFullYear() 方法返回日期的完整年：</p>
    <p id="demo"></p>
    <script>
        var d = new Date;
        document.getElementById("demo").innerHTML = d.getFullYear();
    </script>
</body>

</html>